<?php
session_start();
session_commit();
if (!isset($_SESSION['role'])){
    echo "
    <script>
        alert('请先登录！')
        window.location.pathname = '/TeacherStuSys/login.php'
    </script>
    ";
}else{
    $mapOfRequireCookies = ['uName', 'uId', 'uDep', 'role', 'uImg'];

    foreach ($mapOfRequireCookies as $idx => $cookieName){
        if (!isset($_COOKIE[$cookieName])) setcookie($cookieName, $_SESSION[$cookieName], 0,'/TeacherStuSys');
    }

}



